package cn.edu.tju.core.security.rest;

import cn.edu.tju.core.model.Person;
import cn.edu.tju.core.security.service.PersonService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/api")
public class PersonController {

    @Autowired
    private PersonService personService;

    /**
     * 获取所有 Person 列表
     * @return 包含所有 Person 的列表
     */
    @GetMapping("/persons")
    public ResponseEntity<List<Person>> getAllPersons() {
        List<Person> personList = personService.getAllPersons();
        return ResponseEntity.ok(personList);
    }
}
